package com.kingwang.training.ooad.coffeemaker.badway;

import com.kingwang.training.ooad.coffeemaker.hardware.api.WarmerPlateStatus;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 保温盘
 *
 * @author King
 */
@Component
public class WarmerPlate {
    @Resource
    private PlateSensor sensor;

    @Resource
    private PlateHeater heater;

    public void on() {
        this.heater.on();
    }

    public void off() {
        this.heater.off();
    }

    public WarmerPlateStatus getStatus() {
        return WarmerPlateStatus.values()[this.sensor.sense()];
    }
}
